<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    290. Word Pattern
   </h1>
   <p>
    Given a
    <code>
     pattern
    </code>
    and a string
    <code>
     str
    </code>
    , find if
    <code>
     str
    </code>
    follows the same pattern.
   </p>
   <p>
    Here
    <b>
     follow
    </b>
    means a full match, such that there is a bijection between a letter in
    <code>
     pattern
    </code>
    and a
    <b>
     non-empty
    </b>
    word in
    <code>
     str
    </code>
    .
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> pattern = <code>"abba"</code>, str = <code>"dog cat cat dog"</code>
<strong>Output:</strong> true</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>pattern = <code>"abba"</code>, str = <code>"dog cat cat fish"</code>
<strong>Output:</strong> false</pre>
   <p>
    <strong>
     Example 3:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> pattern = <code>"aaaa"</code>, str = <code>"dog cat cat dog"</code>
<strong>Output:</strong> false</pre>
   <p>
    <strong>
     Example 4:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> pattern = <code>"abba"</code>, str = <code>"dog dog dog dog"</code>
<strong>Output:</strong> false</pre>
   <p>
    <b>
     Notes:
    </b>
    <br>
    You may assume
    <code>
     pattern
    </code>
    contains only lowercase letters, and
    <code>
     str
    </code>
    contains lowercase letters that may be separated by a single space.
   </p>
  </div>
  <div>
   <h1 class="question_title">
    290. 单词模式
   </h1>
   <p>
    给定一种
    <code>
     pattern(模式)
    </code>
    &nbsp;和一个字符串&nbsp;
    <code>
     str
    </code>
    &nbsp;，判断
    <code>
     str
    </code>
    是否遵循相同的模式。
   </p>
   <p>
    这里的
    <strong>
     遵循
    </strong>
    指完全匹配，例如，&nbsp;
    <code>
     pattern
    </code>
    &nbsp;里的每个字母和字符串&nbsp;
    <code>
     str
    </code>
    <strong>
     &nbsp;
    </strong>
    中的每个非空单词之间存在着双向连接的对应模式。
   </p>
   <p>
    <strong>
     示例1:
    </strong>
   </p>
   <pre><strong>输入:</strong> pattern = <code>"abba"</code>, str = <code>"dog cat cat dog"</code>
<strong>输出:</strong> true</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><strong>输入:</strong>pattern = <code>"abba"</code>, str = <code>"dog cat cat fish"</code>
<strong>输出:</strong> false</pre>
   <p>
    <strong>
     示例 3:
    </strong>
   </p>
   <pre><strong>输入:</strong> pattern = <code>"aaaa"</code>, str = <code>"dog cat cat dog"</code>
<strong>输出:</strong> false</pre>
   <p>
    <strong>
     示例&nbsp;4:
    </strong>
   </p>
   <pre><strong>输入:</strong> pattern = <code>"abba"</code>, str = <code>"dog dog dog dog"</code>
<strong>输出:</strong> false</pre>
   <p>
    <strong>
     说明:
    </strong>
    <br>
    你可以假设&nbsp;
    <code>
     pattern
    </code>
    &nbsp;只包含小写字母，&nbsp;
    <code>
     str
    </code>
    &nbsp;包含了由单个空格分隔的小写字母。&nbsp; &nbsp;&nbsp;
   </p>
  </div>
 </body>
</html>